<%--
  Created by IntelliJ IDEA.
  User: 26355
  Date: 2019/1/22
  Time: 16:35
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>写邮件</title>
    <script src="/layui-2.4/layui-v2.4.5/layui/layui.js" charset="utf-8"></script>
    <link rel="stylesheet" href="/layui-2.4/layui-v2.4.5/layui/css/layui.css">
    <script src="/js/jquery.min.3.1.0.js" charset="utf-8"></script>

</head>
<body>
<div class="layui-form-item">
    <label class="layui-form-label">收件人地址</label>
    <div class="layui-input-block">
        <input name="title" class="layui-input" type="text" placeholder="请输入收件人地址" id="target" autocomplete="off" lay-verify="title">
    </div>
</div>
<div class="layui-form-item">
    <label class="layui-form-label">邮件标题</label>
    <div class="layui-input-block">
        <input name="title" class="layui-input" type="text" placeholder="请输入标题" id="emailTitle" autocomplete="off" lay-verify="title">
    </div>
</div>

<div class="layui-form-item layui-form-text">
    <label class="layui-form-label">请输入邮件内容</label>
    <div class="layui-input-block">
        <textarea class="layui-textarea" placeholder="请输入内容" id="emailContent"></textarea>
    </div>
</div>
<button class="layui-btn layui-btn-primary layui-btn-sm" onclick="send()">发送</button>
</body>
<script>
    function send() {
        var title=document.getElementById("emailTitle").value;
        var message=document.getElementById("emailContent").value;
        var email=document.getElementById("target").value;

        if (null==title||""==title||null==target||""==target) {
            alert("标题或收件人地址不能为空");
        }else {

            $.post('/fontMessageHome',
                { "operate": "add","title":title,"message": message,"email":email},
                 function () {
                    alert("发送成功");
                });
        }
    }
</script>
</html>
